package edu.uwosh.cs342.group2.project4.storage;

import java.util.ArrayList;

import com.google.android.maps.GeoPoint;


public class Coordinates {

	private double lat, lng;

	public Coordinates(String lat, String lng) {

		this.lat = Double.parseDouble(lat);
		this.lng = Double.parseDouble(lng);

	}

	public Coordinates(double lat, double lng) {

		this.lat = lat;
		this.lng = lng;
		

	}
	
	public void setCords(Object lat, Object lng){
		
		if (lat instanceof String && lng instanceof String) {
			this.lat = Double.parseDouble((String) lat);
			this.lng = Double.parseDouble((String) lng);
		}

		else {
			this.lat = (Double) lat;
			this.lng = (Double) lng;
		}

	}
	
	public GeoPoint getCords(){
		 return new GeoPoint(
	            (int) (lat * 1E6), 
	            (int) (lng * 1E6));
	 
	}
	public ArrayList<Double> getLatLng(){
		ArrayList<Double> stuff = new ArrayList<Double>();
		stuff.add(lat);
		stuff.add(lng);
		return stuff;
	}

	/**
	 * Gets the original latitude of the point
	 */
	public double getLatitude() {
		return this.lat;
	}
	
	/**
	 * Gets the original longitude of the point
	 * @return
	 */
	public double getLongitude() {
		return this.lng;
	}
}
